import sys
import fileinput

import argparse


parser = argparse.ArgumentParser()
parser.add_argument("textToReplace", help="text To Replace")
args = parser.parse_args()

textToReplace=args.textToReplace


out=textToReplace+"_grpc.h"
textToSearch="nnnnnnnnn"


with open(out, 'w') as f:
    print(
        '''
#include <string>
using namespace std;
#include "nnnnnnnnn.grpc.pb.h"
#include "nnnnnnnnn.pb.h"
#include <grpc++/grpc++.h>
using grpc::Server;
using grpc::ServerBuilder;
using grpc::ServerContext;
using grpc::Status;

using nnnnnnnnn_pack::nnnnnnnnnSetRequest;
using nnnnnnnnn_pack::nnnnnnnnnSetReply;
using nnnnnnnnn_pack::nnnnnnnnnGetRequest;
using nnnnnnnnn_pack::nnnnnnnnnGetReply;
''', file=f)
with fileinput.FileInput(out, inplace=True) as file:
    for line in file:
        print(line.replace(textToSearch, textToReplace), end='')